<!DOCTYPE html>
<html lang="pt-BR">
    <head>
        <?php
        session_start();
        include_once'bloco/head.php';
        include_once '../control/conexao.php';

        function __autoload($classe) {
            include_once"../model/{$classe}.class.php";
        }
        ?>
        <link href="bootstrap/css/morris.css" rel="stylesheet">
    </head>
    <body>      
        <div id="wrapper">
            <?php
            include_once'bloco/navbar.php';
            include_once '../control/valida_perfil.php';
            ?>
            <div id="page-wrapper">
                <?php include_once 'bloco/banner.php'; ?>                
                <div class="row">
                    <div class=" panel panel-success">
                        <div class="panel-heading">
                            <p class="panel-title"><i class = "glyphicon glyphicon-file"></i> Cadastro de Vaga</p>
                        </div>
                        <div class="panel-body">
                            <div class="col-lg-12">
                                <form autocomplete="off" role="form" name="form_cadastra_vaga" method="post" action="../control/cadastrar_vaga.php">                                    
                                    <input type="hidden" value="4" name="perfil">
                                    <div class="row">
                                        <div class="col-lg-2"></div>
                                        <div class="col-lg-8">
                                            <div class="alert alert-success alert-dismissable">                                                
                                                <table class="table">                                                    
                                                    <?php
                                                    if ($_SESSION['usuario']->id_perfil == 4) {
                                                        ?><input type="hidden" name="id_empresa" value="<?php echo $_SESSION['usuario']->id_usuario ?>"><?php
                                                    } else {
                                                        $empresa = new empresa();
                                                        $empresaDAO = new empresaDAO();
                                                        $empresa = $empresaDAO->listar($empresa, null);
                                                        $ln = count($empresa);
                                                        ?>
                                                        <tr>
                                                            <td><strong>Empresa</strong></td>
                                                            <td>
                                                                <select name="id_empresa" id="empresa" required="" class="btn btn-block">
                                                                    <option value="">Selecione...</option>
                                                                    <?php
                                                                    for ($i = 0; $i < $ln; $i++) {
                                                                        ?>
                                                                        <option value="<?php echo $empresa[$i]->id_empresa ?>"><?php echo utf8_encode($empresa[$i]->empresa_sigla) ?></option>
                                                                    <?php } ?>                                
                                                                </select>
                                                            </td>
                                                        </tr>
                                                    <?php } ?>
                                                    <tr>
                                                        <td><strong>Curso</strong></td>
                                                        <?php
                                                        $curso = new curso();
                                                        $cursoDAO = new cursoDAO();
                                                        $cursoDAO->listar($curso);
                                                        $ln = count($_SESSION['arr_curso']);
                                                        ?>
                                                        <td>
                                                            <select name="id_curso" id="curso" required="" class="btn btn-block">
                                                                <option value="">Selecione...</option>
                                                                <?php
                                                                for ($i = 0; $i < $ln; $i++) {
                                                                    ?>
                                                                    <option value="<?php echo $_SESSION['arr_curso'][$i]->id_curso ?>"><?php echo utf8_encode($_SESSION['arr_curso'][$i]->curso_nome) ?></option>
                                                                <?php } ?>                                
                                                            </select>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td><strong>Tipo de Vaga</strong></td>
                                                        <td>
                                                            <select name="tipo" required="" class="btn btn-block">
                                                                <option value="">Selecione...</option>
                                                                <option value="Estagio">Estagio</option>
                                                                <option value="Emprego">Emprego</option>
                                                            </select>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </div>
                                            <div class="alert alert-success alert-dismissable">
                                                <table class="table">                                                    
                                                    <tr>
                                                        <td>Vantagens:<td>
                                                    </tr>                                                    
                                                    <tr>
                                                        <td><strong>Bolsa / Salário</strong></td>
                                                        <td><input type="text" name="bolsa" class="form-control" size="8" required autofocus></td>
                                                    </tr>                                                    
                                                    <tr>
                                                        <td><strong>Refeição</strong></td>
                                                        <td><input type="checkbox" name="refeicao" autofocus></td>
                                                    </tr>                                                    
                                                    <tr>
                                                        <td><strong>Transporte</strong></td>
                                                        <td><input type="checkbox" name="transporte" autofocus></td>
                                                    </tr>
                                                    <tr>
                                                        <td><strong>Assistência Médica</strong></td>
                                                        <td><input type="checkbox" name="ass_medica" autofocus></td>
                                                    </tr>
                                                    <tr>
                                                        <td><strong>Assistência Odontológica</strong></td>
                                                        <td><input type="checkbox" name="ass_odontologica" autofocus></td>
                                                    </tr>
                                                    <tr>
                                                        <td><strong>Outras Assitências</strong></td>
                                                        <td><input type="text" name="ass_outros" class="form-control" autofocus></td>
                                                    </tr>
                                                </table>
                                            </div>

                                            <div class="alert alert-success alert-dismissable">
                                                <table class="table">
                                                    <tr>
                                                        <td>Pré-Requisitos:</td>
                                                    </tr>

                                                    <tr>
                                                        <td><strong>Cidade onde deve residir</strong></td>
                                                        <td><input type="text" name="pre_cidade" class="form-control" autofocus></td>
                                                    </tr>
                                                    <tr>
                                                        <td><strong>Idiomas</strong></td>
                                                        <td><input type="text" name="pre_idioma" class="form-control" autofocus></td>
                                                    </tr>
                                                    <tr>
                                                        <td><strong>Outros Cursos</strong></td>
                                                        <td><input type="text" name="pre_cursos" class="form-control" autofocus></td>
                                                    </tr>
                                                    <tr>
                                                        <td><strong>CNH</strong></td>
                                                        <td><input type="checkbox" name="pre_cnh" autofocus> </td>
                                                        <td></td>
                                                    </tr>
                                                    <tr>
                                                        <td><strong>Habilidades</strong></td>
                                                        <td><textarea name="pre_habilidades" class="form-control"></textarea></td>     
                                                    </tr>
                                                </table>
                                            </div>
                                            <div class="alert alert-success alert-dismissable">
                                                <table class="table">
                                                    <tr>
                                                        <td><strong>Descrição</strong></td>
                                                        <td><textarea name="descricao" class="form-control" required></textarea></td>     
                                                    </tr>
                                                    <tr>
                                                        <td><strong>Carga Horária</strong></td>
                                                        <td><input type="text" name="carga_horaria" class="form-control" required autofocus></td>
                                                    </tr>
                                                    <tr>
                                                        <td><strong>Vaga valida até</strong></td>
                                                        <td><input type="text" name="data_limite" id="data_limite" class="btn btn-block" required autofocus ></td>
                                                    </tr>
                                                </table>
                                            </div>
                                            <?php $data = date("Y/m/d") ?>
                                            <input type="hidden" name="data_abertura" value="<?php echo $data ?>">
                                            <div align="center">
                                                <button class="btn btn-lg btn-success" type="submit">Cadastrar</button>
                                            </div>
                                        </div>
                                        <div class="col-lg-2"></div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <?php
        include_once'bloco/scripts.php';
        ?>        
        <link rel="stylesheet" href="bootstrap/js/data/data.css"/>
        <script src="bootstrap/js/data/jquery-1.8.2.js"></script>
        <script src="bootstrap/js/data/jquery-ui.js"></script>
        <script>
            $(function() {
                $("#data_limite").datepicker({
                    dateFormat: 'dd-mm-yy',
                    changeMonth: true,
                    changeYear: true,
                    dayNames: ['Domingo', 'Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sábado', 'Domingo'],
                    dayNamesMin: ['D', 'S', 'T', 'Q', 'Q', 'S', 'S', 'D'],
                    dayNamesShort: ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb', 'Dom'],
                    monthNames: ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'],
                    monthNamesShort: ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez']
                });
            });
        </script>
    </body>
</html>
